﻿
@{
    ViewData["Title"] = "Index";
    Layout = "~/Views/Shared/_rootLayout.cshtml";
}

@await Html.PartialAsync("_pagingLayout")

<div class="row">
    <div class="col-xs-12">
        <div class="box">
            <div class="box-header with-border">
                <h3 class="box-title">Business Information</h3>
                <div class="box-tools">
                    <span name="opt-create" data-type="create" data-path="" class="label label-success option-hover">Create</span>
                </div>
            </div>
            <div class="box-body div-table-content">
                <div class="box-body" style="overflow-x: auto;">
                    <table id="table" class="table table-bordered table-hover">
                        <thead id="thead">
                            <tr>
                                <th style="width: 60px;">@Html.Label("Id")</th>
                                <th class="col-ins-name">@Html.Label("Name")</th>
                                <th class="col-ins-name">@Html.Label("Description")</th>
                                <th class="col-ins-name">@Html.Label("PIC")</th>
                                <th class="col-ins-name">@Html.Label("Environment")</th>
                                <th class="col-ins-name">@Html.Label("CreateTime")</th>
                                <th style="width:160px;">@Html.Label("Operation")</th>
                            </tr>
                        </thead>
                        <tbody id="tbody"></tbody>
                    </table>
                </div>
                <div class="pull-right">
                    <div id="nav"></div>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/template" id="listTemplate">
    <% _.each(obj,function(item) {%>
    <tr>
        <td>
            <%=item.id%>
        </td>
        <td>
            <%=item.name%>
        </td>
        <td>
            <%=item.description%>
        </td>
        <td>
            <%=item.picName%>
        </td>
        <td>
            <%=item.environment.name%>
        </td>
        <td>
            <%=item.createTime%>
        </td>
        <td>
            <span data-type="edit" data-id="<%=item.id%>" class="label label-success option-hover">edit</span>&nbsp;<span data-type="delete" data-id="<%=item.id%>" class="label label-danger option-hover">delete</span>&nbsp;
        </td>
    </tr>
    <% });%>
</script>

<div class="modal fade in" id="createModel" style="display: none;">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">×</span>
                </button>
                <h4 class="modal-title"><label id="crtHeader"></label></h4>
            </div>
            <div class="modal-body">
                <div class="form-horizontal">
                    <div class="box-body">
                        <input id="txtBusinessId" type="hidden" />
                        <div class="form-group">
                            <label class="col-sm-2 control-label">业务名称</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="txtName" name="txtName" placeholder="请输入业务名称...">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">对应环境</label>
                            <div class="col-sm-10">
                                <select id="selectEnvs" class="form-control" asp-items="ViewBag.Environments"></select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">业务描述</label>

                            <div class="col-sm-10">
                                <textarea id="txtDecription" name="txtDecription" class="form-control" placeholder="请输入业务描述..."></textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">负责人</label>

                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="txtPIC" name="txtPIC" placeholder="请输入负责人名称...">
                            </div>
                        </div>
                        <div class="col-xs-12" id="createErrorMsg" style="display: none;">
                            <div class="form-group has-error">
                                <label class="control-label" style=""><i class="fa fa-remove"></i><span style="padding-left: 12px"></span></label>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default pull-left" data-dismiss="modal">Close</button>
                <button type="button" class="btn btn-primary" id="btnSubmit">Save changes</button>
            </div>
        </div>
    </div>
</div>

<environment include="Development">
    <script src="~/lib/underscore/underscore.js"></script>
    <script src="~/js/Business/index.js"></script>
</environment>

<environment exclude="Development">
    <script src="~/lib/underscore/underscore-min.js"></script>
    <script src="~/js/Business/index.min.js"></script>
</environment>



